/*Replication file for "A Good Partisan? Ideology, Loyalty, and Public Evaluations of Members of Congress" by Geoff Sheagley, Logan Dancey, and John Henderson. Legislative Studies Quarterly*/

//Do file by Logan Dancey

//Replication file to generate regression coefficients reported in Table 2 and appendix of manuscript */

*Run this .do file after the 2019CESMerge


*Create new approval variable with more approval higher Never Heard of this Person treated as missing
gen approve_rep=CC19_311a
replace approve_rep=. if approve_rep==5
replace approve_rep=abs(4-approve_rep)
label define approve_rep 0 "Strongly Disapprove" 1 "Disapprove" 2 "Approve" 3 "Srongly Approve"
label value approve_rep approve_rep
tab1 approve_rep CC19_311a

*Create 3 point party id variable from pid7
tab pid7
tab pid7, nolabel
recode pid7 (1/3=1)(4=2)(5/7=3)(8=.), gen(pid3_lean)
label define pid3_lean 1 "Democrat" 2 "Independent" 3 "Republican"
label values pid3_lean pid3_lean
tab pid3_lean pid7


*Democrats -- Table 2
regress approve_rep nominate_dim1 nominate_dim2 oppose_pelosi i.pid7 if party==100 & pid3_lean==1 [pw=commonweight], cluster(bioname)

*Republicans -- Table 2
regress approve_rep nominate_dim1 nominate_dim2 oppose_pelosi i.b7.pid7 if party==100 & pid3_lean==3 [pw=commonweight], cluster(bioname)

*Independents -- Appendix
regress approve_rep nominate_dim1 nominate_dim2 oppose_pelosi if party==100 & pid3_lean==2 [pw=commonweight], cluster(bioname)







